#! /usr/bin/env node


console.log("1111111");

const args = process.argv[2]; // 获取命令行参数
const axios = require("axios");
const url = "http://api.tianapi.com/txapi/xingzuo/index?key=1d89bae77797cf1c4469e459bc46e469&me=";
const chalk = require("chalk"); // 命令行美化工具（字体颜色）

console.log(args);
console.log(encodeURI(args));


axios.get(url+encodeURI(args)).then(res=>{
    console.log(res.data); 
    let result = res.data;
    let conTxt = ""
    if (result.code == 200){
        for (let i in result.newslist[0]){
            console.log(i,"--------");
            console.log(result.newslist[0][i]);
            conTxt += `${chalk.green(i)}:${chalk.yellow(result.newslist[0][i])}\n\n`
         }

         console.log(conTxt);
         
    }
})